;layui.define(['jquery',], function (exports) {
    let $ = layui.$,
        MOD_NAME = "fa_side",
        debug = true,
        log = function log(...msg) {
            debug && console.log("FA", MOD_NAME, ...msg)
        };
    let Fa_Side = function () {
        this.o = {
            switch: $('.fa-side-switch'),
            box: $('.fa-layout'),
            side_off: 'fa-side-off'
        }
        this.init();
    }
    Fa_Side.prototype.init = function () {
        let _this = this;
        $(_this.o.switch).on('click', function (event) {
            if (_this.o.box.hasClass(_this.o.side_off)) {
                _this.open();
            } else {
                _this.close();
            }
            event.stopPropagation();
        })
        log('init ')
    }
    Fa_Side.prototype.close = function () {
        log('close')
        this.o.box.addClass(this.o.side_off);
    }
    Fa_Side.prototype.open = function () {
        log('open')
        this.o.box.removeClass(this.o.side_off);
    }

    exports(MOD_NAME, {
        side: new Fa_Side(),
        open: function () {
            this.side.open();
        },
        close: function () {
            this.side.close();
        }
    })
})